<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>审核列表</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/src/layui.all.js"></script>
    <script src="/layui/src/jquery-3.2.1.min.js"></script>

</head>
<style>
    #row2{
        margin-bottom:180px;
    }
    .pre_home{
        width:78%;
        height:100%;
        margin-left: 10px;
    }
    body{
        background-color:#F6F7F9;
    }
    /*
       头部
    */
    .div_tit{
        width:89%;
        height:50px;
        background-color:#F2F2F2;
        border:2px solid #E6E6E6;
        margin-bottom: 10px;
        margin-left: 10px;
    }
    .tit_span{
        margin-left:10px;
        margin-top:-20px;
        color:#999999;
    }
    .tit_btn{
        margin-left:88%;
        margin-top:-35px;
    }
    .tit_btn2{
        margin-top:-35px;
    }
    .div_ic{
        width:5px;
        height:20px;
        background-color:#1ABC9C;
        margin-top:15px;
    }
    /*
        检索
    */
    .div_index{
        margin-right:20px;
        width: 125%;
        height:130px;
        margin-bottom:10px;
        border:1px solid #E6E6E6;
    }
    .div_index_title{
        width:122%;
        height:55px;
        background-color:#F3F3F3;
        border:1px solid #E6E6E6;
        font-weight:bold;
        line-height:55px;
        font-size:16px;
        text-indent:18px;
        color:#666666;
    }
    .index_btns1{
        width: 100px;
        height: 43px;
        margin-left: 77.2%;
        margin-top: 0%;
    }

    .div_index_input{
        width:122%;
        height:72px;
        background-color:#FFFFFF;
    }
    .index_li_item{
        margin-top:18px;
        width:255px;
        float:left;
        margin-left: 1.5%;
    }
    #indexBtn{
        margin-left: 35px;
        width: 80px;
    }
    #resetBtn{
        margin-left: 45px;
        width: 80px;
    }
    #btn_icom{
        font-size: 14px;
        margin-left: -8px;
    }
    /*
        用户数据列表
    */
    .div_list{
        margin-right:20px;
        width:1123px;
        height:526px;
        margin-bottom:10px;
    }
    .div_list_title{
        width:152%;
        height:55px;
        background-color:#F3F3F3;
        border:1px solid #E6E6E6;
        font-weight:bold;
        line-height:55px;
        font-size:16px;
        color:#666666;
        text-indent:18px;
    }
    #userListTab{
        margin-top: -10px;
    }
    #imglayerId{
        display: none;
    }
    #test1{
        margin-left: 20px;
    }
    .div_index_ul1{
        margin-left: 82.4%;
    }


</style>



<body>
<div class="layui-row" id="row2">
    <div class="layui-col-md12 layui-col-xs12 layui-col-sm12 layui-col-lg12">
        <!-- 头部 -->
        <div class="div_tit">
            <div class="div_ic"></div>
            <p class="tit_span">审核列表<p>
            <button type="button" class="layui-btn tit_btn layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>刷新
            </button>
            <button type="button" class="layui-btn tit_btn2 layui-btn-sm">
                <i class="layui-icon layui-icon-return"></i>返回
            </button>
        </div>
    </div>
    <!-- 头部结束 -->
    <div class="layui-col-md9 layui-col-xs9 layui-col-sm10 layui-col-lg9">
        <div class="pre_home">
            <!-- 检索 -->
            <div class="div_index">
                <div class="div_index_title">
                    <i class="layui-icon layui-icon-search"></i>
                    筛选查询
                    <button type="button" class="layui-btn layui-btn-xs index_btns1" id="put_screen">
                        <i class="layui-icon layui-icon-down layui-font-9"></i>收起筛选
                    </button>
                    <button type="button" class="layui-btn layui-btn-xs index_btns1" id="index_btn1">
                        <i class="layui-icon layui-icon-survey layui-font-9"></i>高级检索
                    </button>
                </div>
                <div class="div_index_input">
                    <form class="layui-form" id="selIndex">
                        <ul class="div_index_ul">
                            <li class="index_li_item">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">用户账号:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="account" placeholder="请输入用户账号" class="layui-input">
                                    </div>
                                </div>
                            </li>
                            <li class="index_li_item">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">用户姓名:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="trueName" placeholder="请输入用户姓名" class="layui-input">
                                    </div>
                                </div>
                            </li>
                            <li class="index_li_item">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">注册时间:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="registerTime" placeholder="请选择注册时间" class="layui-input" id="registerTime">
                                    </div>
                                </div>
                            </li>
                        </ul>
                        <ul class="div_index_ul1">
                            <li class="index_li_item" style="width:100px;">
                                <button type="button" class="layui-btn" id="indexBtn">
                                    <i class="layui-icon layui-icon-search" id="btn_icom"></i>
                                    搜索
                                </button>
                            </li>
                            <li class="index_li_item" style="width:100px;">
                                <button type="reset" class="layui-btn layui-btn-danger" id="resetBtn">
                                    <i class="layui-icon layui-icon-refresh-3" id="btn_icom"></i>
                                    重置
                                </button>
                            </li>
                        </ul>
                    </form>
                </div>
            </div>
            <!-- 数据列表 -->
            <div class="div_list">

                <div class="div_list_title">
                    <i class="layui-icon layui-icon-list"></i>
                    审核列表
                </div>
                <table id="userListTab">
                </table>
            </div>
        </div>
    </div>
</div>
<script>
    var layer;
    var element;
    var form;
    var laydate;
    var table;
    var upload;
    layui.use(['element','layer','laydate','form','table'], function(){
        layer = layui.layer;
        element = layui.element;
        form = layui.form;
        laydate = layui.laydate;
        table = layui.table;
        upload = layui.upload;



        laydate.render({
            elem: '#registerTime', //指定元素
            type: 'date',
            trigger: 'click' //时间时间为点击事件
        });
        load();
        selAuditList();
    })

    /**
     *  按钮  点击事件 刷新页面  返回  检索
     * */
    function load(){
        let i=true;
        //收起筛选，放下
        $("#put_screen").bind('click',function(){
            if(i){//判断i如果为true，则隐藏搜索，如果为false则展示搜索
                $("#selIndex").attr("style","display:none;");
                $(".div_list_title").attr('style',"margin-top: -84px;")
                $("#put_screen").html("<i class='layui-icon layui-icon-up ayui-font-9'></i>打开筛选")
                i=false;
            }else{
                $("#selIndex").attr("style","dispaly:block;");
                $(".div_list_title").attr('style',"margin-top: 0px;")
                $("#put_screen").html("<i class='layui-icon layui-icon-down ayui-font-9'></i>收起筛选")
                i=true;
            }
        })
        //刷新页面按钮
        $(".tit_btn").bind('click',function(){
            location.reload();
        })
        //返回按钮
        $(".tit_btn2").bind('click',function(){
            window.history.go(-1);  //返回上一页
        })
        //检索按钮
        $("#indexBtn").bind('click',function(){
            selIndexUserTab('')
            layer.msg("搜索成功", {icon: 1});
        })


    }

    function selAuditList(){
        $.post("/personnel/selAuditList", {}, function (res) {
            if(res.data){
                console.log(res.data)
                layer.msg("启用成功",{icon:1});
                userTab(res.data);
            }else{
                layer.msg("启用失败",{icon:2});
                userTab(res.data);
            }
        });
    }


    function userTab(item){
        table.render({
            elem:"#userListTab",//容器
            title:"审核列表",
            limit:10,//分页显示条数
            width:1702,
            data:item,
            toolbar:true,
            page:true,
            cols:cols
        });
    }


    var cols=[[//定义列
        {type:'checkbox',align:'center',width:40},//复选框靠左
        {title:'序号',align:'center',width:50,templet:function(data){
                return data.LAY_INDEX;
            }},
        {field:"nickname",title:"用户姓名",align:'center',width:160},
        {field:"account",title:"用户账号",align:'center',width:160},
        {field:"email",title:"邮箱",align:'center',width:160},
        {field:"phone",title:"电话",align:'center',width:160},
        {field:"remarks",title:"申请原因",align:'center',width:200},
        {field:"role_name",title:"申请内容",align:'center',width:160},
        {field:"type",title:"类型",align:'center',width:160,templet:function(data){
                if(data.type==2){//2前台
                    return"前台用户"
                }else if(data.status==2){//3后台
                    return"后台用户"
                }
            }},
        {field:"create_date",title:"申请时间",align:'center',width:180},
        {field:"",title:"操作",align:'center',templet:function(data){
                return "<a style='color:#009688;cursor:pointer;' onclick='selBackUser(\""+data.userId+"\")'>查看</a> "+
                    "<a style='color:#009688;cursor:pointer;' onclick='updBackUser(\""+data.userId+"\")'>编辑</a> ";

            }}
    ]];









</script>
</body>
</html>